$(function () {


    $('.goto-regis').on("click", function () {
        $(".loging").css('display', "none")
        $('.regis').css('display', "block")

    })
    $('.login-g').on("click", function () {
        $(".regis").css('display', "none")
        $('.loging').css('display', "block")
    })




    // 登录
    $('#login-submit').on("click", function () {

        let l_name = $("#username").val();
        let ps = $("#password").val();

        if (l_name == "" || ps == "") {
            // 如果为空,显示错误
            $('#u-tips').text('账户或密码不能为空').removeClass("tips")
            setTimeout(function () {
                $('#u-tips').addClass("tips")
            }, 2000)
            return false
        } else {
            let uname = localStorage.getItem("uname");
            let username = localStorage.getItem("username");
            let password = localStorage.getItem("password");

            if (l_name == username && ps == password) {
                // 跳转
                localStorage.setItem("isLogin", "true");

                if (localStorage.getItem("target") != "" && localStorage.getItem("target")) {
                    location.href = localStorage.getItem("target");
                    localStorage.removeItem('target');
                }
                location.href = "file:///C:/Users/Administrator/Desktop/%E9%A1%B9%E7%9B%AE/kangkangs-tesco-project/index.html";
            } else {
                $('#u-tips').text('账户或密码错误').removeClass('tips')
                setTimeout(function () {
                    $('#u-tips').addClass("tips")
                }, 2000)
            }
        }

    })






})